<template>
  <div>
    <Header title="修改供应商信息"></Header>
    <div class="order">
      <h2>基本信息</h2>
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="编码">
          <el-input v-model="form.code"></el-input>
        </el-form-item>
        <el-form-item label="供应商名">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="联系人">
          <el-input v-model="form.linkman"></el-input>
        </el-form-item>
        <el-form-item label="电话">
          <el-input v-model="form.phone"></el-input>
        </el-form-item>
        <el-form-item label="所属地区">
          <el-input v-model="form.area"></el-input>
        </el-form-item>
        <el-form-item label="详细地址">
          <el-input v-model="form.detailAddres"></el-input>
        </el-form-item>
        <el-form-item label="活动性质">
          <el-radio-group v-model="form.type">
            <el-radio label="正常" name="type"></el-radio>
            <el-radio label="关闭" name="type"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">立即创建</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import Header from "@/components/goods/header";
export default {
  components: {
    Header,
  },
  data() {
    return {
      suppercode: this.$store.state.common.supperCode,
      form: {
        name: "",
        code: "",
        linkman: "",
        phone: "",
        area: "",
        type: [],
        detailAddres: "",
      },
    };
  },
  created() {},
  methods: {
    onSubmit() {
      this.$http
        .post("http://120.76.56.2:3001/purcase/purchaseOrder/update", {
          code: this.form.code,
          supplier: this.form.name,
          linkman: this.form.linkman,
          linkmanNumber: this.form.phone,
          area: this.form.area,
          detailAdress: this.form.detailAddres,
          state: this.form.type[0],
        })
        .then((ret) => {
          this.$message({
            type: "success",
            message: ret.msg,
          });
          setTimeout(() => {
            this.$router.go(-1);
          }, 2000);
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.order {
  font-family: "微软雅黑 Bold", "微软雅黑 Regular", "微软雅黑";
  margin: 0 auto;
  border-width: 0px;
  width: 1100px;
  height: 600px;
  background: inherit;
  background-color: rgba(255, 255, 255, 1);
  border: none;
  border-radius: 0px;
  box-shadow: none;
  overflow: hidden;
  margin-top: 10px;
  padding: 20px;
  box-sizing: border-box;
  h2 {
    font-size: 14px;
    height: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ccc;
  }
}
</style>